@extends('admin.master')

@section('title', '设备列表')

@section('title_top')
    @parent
    <div class="title_top">设备列表</div>
@stop
 			
@section('equip_query')
<div class="equip_num"><p class="equip_tit">设备编号</p><input type="text" class="equip_num1" value="{{ $deviceCode }}" /></div>
<div class="equip_status">
	<p class="status_txt">设备状态</p>
	<p class="status">{{ $status or '全部' }}</p>
	<!-- 弹出下拉框 -->
	<div class="down_menu">
		<a>全部</a>
		<a>缺水</a>
		<a>检修</a>
	</div>	
</div>
<a class="query_btn query_equip">查询</a>
@stop

@section('userinfo_tab')
<table cellpadding="0" cellspacing="0" class="equip_table">
	<thead>
		<tr>
			<td>设备编号</td>
			<td>RO滤芯使用时间</td>
			<td>普通滤芯使用时间</td>
			<td>单日制水量</td>
			<td>总制水量</td>
			<td>设备状态</td>
			<td>记录时间</td>
			<td>历史记录</td>
		</th>
	</thead>
	<tbody>
		@foreach($deviceList as $deviceInfo)
			@if($deviceInfo->dec_status == App\Models\DeviceInfo::HYDROPENIA)
		<tr class="less_bg">
			@elseif($deviceInfo->dec_status == App\Models\DeviceInfo::OVERHAUL)
		<tr class="service_bg">
			@else
		<tr >
			@endif
			<td>{{ $deviceInfo->device->code }}</td>
			<td>{{ $deviceInfo->filter_cnt2 }} min</td>
			<td>{{ $deviceInfo->filter_cnt1 }} min</td>
			<td>{{ $deviceInfo->daily_water_consumption }} L</td>
			<td>{{ $deviceInfo->water_cnt }} L</td>
			<td>{{ $deviceInfo->device_status_description }}</td>
			<td>{{ $deviceInfo->created_at }}</td>
			<td><a class="check_box" href="/admin/device/history?deviceId={{ $deviceInfo->device_id }}">查看</a></td>
		</tr>
		@endforeach
	</tbody>
</table>
@stop

@section('page_num')
    <ul class="pagination pagination-lg"> 
	@if(count($deviceList))
		<?php 
		$queryParam = empty($deviceCode)? []: ['deviceCode' => $deviceCode];
		$queryParam = empty($status)? $queryParam: array_merge($queryParam, ['status' => $status]); ?>
    	{!! $deviceList->appends($queryParam)->render() !!}
    @endif
    </ul>
@stop
@section('infor_promit')
@parent
<script type="text/javascript">
	//设备查询
	$(".query_equip").click(function(){
	    var equip_in=$(".equip_num1").val();
	    var status_in=$(".status").html();
	    if(equip_in=="%"){
	    	hint("非法输入，请正确输入编号！");
	    }else{
	    	window.location.href='/admin/device/index?deviceCode='+equip_in+'&status='+status_in;
		}
	});
</script>
@stop
